<template>
		<!--
        	作者：liushihao@yixuninfo.com
        	时间：2017-02-06
        	描述： active
        -->
		<div class="fixed-footer" id="goble_menu_div">
			<!-- <router-link class="footer-icon" to="/index">
				<span class="footer-icon"></span>首页
			</router-link> -->
			<a class="footer-list active" @click="index"><span class="footer-icon"></span>首页</a>
			<a class="footer-list" @click="declare"><span class="footer-icon footer-sec"></span>报备</a>
			<a class="footer-list" @click="dynamic"><span class="footer-icon footer-thrd"></span>动态</a>
			<a class="footer-list" @click="my"><span class="footer-icon footer-four"></span>我的</a>
		</div>
</template>
<script>
	import reportFailDialogOptions from '../../js/reportFailDialogOptions'
	import Utils from '../../js/utils'
export default {
  data () {
    return {
			originActiveMenuIndex: 0, // 点报备页面无效，菜单激活恢复
    }
  },
  mounted:function(){
	  this.initMenu();
	//   this.index();
  },
  methods:{
	index () {
        this.$router.push({
            path: '/index'
        })
  	},
  	declare:function(){
			const _this = this;
			//若为游客则弹出绑定对话框
			// if(!this.tourist()){
			if(Utils.tourist(Utils.getUserRole())) {
				reportFailDialogOptions.btn1 = function () {
					const aLink = $(".fixed-footer a");
					$(aLink).eq(_this.originActiveMenuIndex).addClass("active");
					$(aLink).eq(1).removeClass("active"); //报备移除
					layer.close(index);
				}
				reportFailDialogOptions.btn2 = function () {
					_this.$router.push({path:'/bindCompany'});
					layer.close(index);
					return
				}
				var index = layer.open(reportFailDialogOptions);
				return ;
			}
			this.$router.push({
				path: '/declare'
			})
  	},
  	dynamic:function(){
  		//若为游客则弹出绑定对话框
        if(!this.tourist()){
            return ;
        }
        this.$router.push({
            path: '/dynamic'
        })
  	},
  	my:function(){
  		//若为游客则弹出绑定对话框
        if(!this.tourist()){
			return;
        }
        this.$router.push({
            path: '/my'
        })
  	},
  	initMenu:function(){
  		$("body").on('click','.fixed-footer a',function(){
  			var aLink = $(".fixed-footer a");
  			for (var i=0;i<aLink.length;i++) {

  					$(aLink).eq(i).removeClass("active");
  			}
  			$(this).addClass("active");
  		});

  	}
  }
}
</script>

